#include "Geometry.h"
#include "VertexLayout.hpp"
VertexLayout Geometry::Layout = {{{GL_FLOAT, 3}, {GL_FLOAT, 2}}};

Geometry::Geometry() : m_va(nullptr), m_vb(nullptr), m_ib(nullptr)
{
}

Geometry::~Geometry()
{
	delete m_va;
	delete m_vb;
	delete m_ib;
}

void Geometry::bind() const
{
	m_va->bind();
}

void Geometry::unbind() const
{
	m_va->unbind();
}

void Geometry::setup(const Vertices &v, const Indices &i)
{
	m_vb = new VertexBuffer(v.data(), v.size() * sizeof(Vertex));
	m_ib = new IndexBuffer(i.data(), i.size());
	m_va = new VertexArray(*m_vb, Layout, *m_ib);
}
